import { Component } from 'react';
import { WebView } from '@tarojs/components';
import Taro from '@tarojs/taro';

export default class WebViewPage extends Component {
  state = {
    url: '',
  };
  componentDidMount() {
    const query = Taro.getCurrentInstance()?.router?.params;
    if (query?.url) {
      this.setState({
        url: query.url,
      });
    }
  }
  render() {
    const { url } = this.state;
    return <WebView src={url} />;
  }
}
